package com.gacu.viewer.client.ui.display_area;

import com.google.gwt.event.dom.client.MouseWheelEvent;
import com.google.gwt.event.dom.client.MouseWheelHandler;

public class DrawerMouseWheelHandler implements MouseWheelHandler
{
	private Drawer dr;
	private DrawerListener dl;
	
	public DrawerMouseWheelHandler(Drawer dr, DrawerListener dl)
	{
		this.dr = dr;
		this.dl = dl;
	}

	@Override
	public void onMouseWheel(MouseWheelEvent event) {
		if (dl.isHolding() == true && dl.rna != null)
		{
			if (event.isSouth())
			{
				dl.rna.rotate((float)10.0);
			}
			else if(event.isNorth())
			{
				dl.rna.rotate((float)-10.0);
			}			
		}
		else
		{
			if (event.isSouth())
			{
				ZoomUtil.doZoom(dr, ZoomUtil.zoomAction.zoomOut);
			}
			else if(event.isNorth())
			{
				ZoomUtil.doZoom(dr, ZoomUtil.zoomAction.zoomIn);
			}
		}
	}
	
	
	
}
